/*
 * serverCondition.h
 *
 *  Created on: Jun 29, 2011
 *      Author: peckb1
 */

#ifndef SERVERCONDITION_H_
#define SERVERCONDITION_H_

#include "serverLock.h"
#include "mailAddress.h"

class ServerCondition {
    private:
        bool isDeleted;
        bool isScheduledForDeletion;
        ServerLock* waitingLock;
        List* CVWaitQueue;
        char* CVName;
        int owningMachine;

    public:
        ServerCondition(char* name, int machineOwner);
        ~ServerCondition();

        MailAddress* Wait(MailAddress* address, ServerLock* lock);
        MailAddress* Signal(MailAddress* address, ServerLock* lock);
        List* Broadcast(MailAddress* address, ServerLock* lock);
        bool DestroyCV(MailAddress* address);

        bool IsDeleted();
        bool IsScheduledForDeletion();

        char* GetName();
};

#endif /* SERVERCONDITION_H_ */
